package com.pj.wisdomlogistics.mvp.presenter;


import com.pj.wisdomlogistics.entity.User;
import com.pj.wisdomlogistics.mvp.contract.LoginContract;
import com.pj.wisdomlogistics.mvp.frame.ActivityPresenter;
import com.pj.wisdomlogistics.mvp.model.LoginModel;
import com.pj.wisdomlogistics.rx.FilterSubscriber;


public class LoginPresenter extends ActivityPresenter<LoginModel,LoginContract.View> implements LoginContract.Presenter{
    public static final String TAG = "LoginPresenter";


    @Override
    public void login(String username, String password) {
        addSubscription(getModel().login(username, password), new FilterSubscriber<User>() {
            @Override
            public void onNext(User mUser) {
                getView().showLoginSuccess(mUser);
            }

            @Override
            public void onError(int errorCode, String errorMsg) {
                getView().showError(errorMsg);
            }

        });
    }
}
